package com.cryptooj.project.judge.codesandbox;

import com.cryptooj.project.judge.codesandbox.impl.ExampleCodeSandbox;
import com.cryptooj.project.judge.codesandbox.impl.RemoteCodeSandbox;
import com.cryptooj.project.judge.codesandbox.impl.ThirdPartyCodeSandbox;
import org.checkerframework.common.reflection.qual.NewInstance;

/**
 *  代码沙箱工厂
 *  （根据字符串传参 new 指定的代码沙箱实例）
 * */
public class CodeSandboxFactory {

    /**
     *  生产代码沙箱实例
     * */
    public static CodeSandbox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
